<?php

namespace app\tiktok\controller;
use app\common\controller\PCBase;
use app\tiktok\logic\AutoshippingLogic;
use Throwable;
use app\common\library\Upload;
use  think\App;
class Autoshipping extends PCBase
{



    /**
     * @desc   自动发货列表
     * @author zhangheng
     * @date   2025-07-04
     */
    public function index(){
        $params     = $this->request->post();
        return  (new AutoshippingLogic())->index($params);
    }

    /**
     * @desc   自动发货修改
     * @author zhangheng
     * @date   2025-07-04
     */
    public function edit(){
        $params     = $this->request->post();
        $admin_id            = $this->getAdminId();
        $params['admin_id']  = $admin_id;
        return  (new AutoshippingLogic())->edit($params);
    }
    /**
     * @desc   自动发货详情
     * @author zhangheng
     * @date   2025-07-04
     */
    public function find(){
        $params     = $this->request->post();
        return  (new AutoshippingLogic())->find($params);
    }

    /**
     * export
     * @throws Throwable
     */
    public function export()
    {
        $params     = $this->request->post();
        return  (new AutoshippingLogic())->export($params);
    }

    
    /**
     * export
     * @throws Throwable
     */
    public function automatic_shipping()
    {
        $params     = $this->request->post();
        return  (new AutoshippingLogic())->automatic_shipping($params);
    }

    /**
     * trackinfo
     * @throws Throwable
     */
    public function trackinfo()
    {
        $params     = $this->request->post();
        return  (new AutoshippingLogic())->trackinfo($params);
    }



    /**
     * @desc   导入订单
     * @author zhangheng
     * @date   2025-07-9
     */
    public function uploadInventory(){
        $adminId    = $this->getAdminId();
        $file       = $this->request->file('file');
        $res        = (new Upload($file))->upload(null, $this->getAdminId()); 
        return  (new AutoshippingLogic())->import($res['url'],$adminId);
    }

}